import fileinput
import sys



def replace():
	searchExp = "element vertex"
	replaceExp = "element vertex 5"

	for line in fileinput.input("file.txt", inplace=1):
	    if searchExp in line:
	    	line = line.replace(searchExp, replaceExp)
	    sys.stdout.write(line)



replace()	